<?php
class User_Form_UserEdit extends User_Form_UserAdd {
	
	public function init() {
		parent::init();
		
        $image = $this->getSubForm('defaulttab')->getElement('image');
        $image
        	->addDecorator(new KontorX_Form_Decorator_File_ImagePreview(array(
        		'imagePath' => User_Model_User::UPLOAD_PATH . 'thumb')));

		$this->getSubForm('defaulttab')
			 ->getElement('email')
			 ->removeValidator('db_no_exsists')
			 ->addValidator(new Zend_Validate_Db_NoRecordExists('user','email',array(
                'field' => 'id',
                'value' => $this->getPrimaryKey()
			 )));
			 
		$this->getSubForm('defaulttab')
			->getElement('password')->setRequired(false);
	}
}